#include <bits/stdc++.h>
using namespace std;

int num[100] = {0};

int main() {
	int count;
	cin >> count;
	for (int i = 0; i < count; ++i) {
		cin >> num[i];
	}
	sort(num, num + count);
	cout << num[count - 1] - num[0];
	return 0;
}